/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-09-03 09:03:00
 * @LastEditors: voanit
 * @LastEditTime: 2022-09-04 15:12:35
 */
'use strict'

exports.__esModule = true
var age1 = '18'
/* 类型注解 */
var arr = [1, 2, 3]
var arr2 = [1, 2, 3]
/* 联合类型 */
var arr3 = [1, 2, 3, '4', [5]]
var arr4 = [1, 2, 3, '4', [5]]
var age2 = '18'
var arr5 = [1, 2, 3]
/* 函数类型 */
/* 单独指定参数、返回值的类型： */
function add(num1, num2) {
  return true
}
var add2 = function (num1, num2) {
  return num1 + num2 + ''
}
var add3 = function (num1, num2) {
  return num1 + num2
}
var add4 = function () {}
// console.log(add4());  undefined====值
/* 可选参数 */
var add5 = function (num1, num2) {
  return '123'
}
add5()
// let name?: string = 'jack'  错误
var obj = {
  id: 1,
  fn: function () {
    // return {}
  },
  fn2: function () {},
}
var obj2 = {
  id: 1,
  // fn: () => {},
  fn2: function () {},
}
var person = {
  // id: 1,
  name: 'rose',
}
var obj3 = {
  X: 1,
  Y: 2,
  Z: 3,
}
/* 元组类型 */
// let position: number[] = [116.2317, 39.5427, 2222, 3333]
var position2 = [116.2317, 39.5427]
/* 类型推论 */
var age = 18
var f1 = function () {
  return
}
/* 字面量类型 */
var str1 = 'Hello TS'
var str2 = 'Hello TS'
var str3 = true
function changeDirection(direction) {
  console.log(direction)
}
var obj6 = {
  gender: '女',
}
changeDirection('up')
var obj11 = {
  id: 1,
  name: 'rose',
  hobby: ['游泳', '旅游'],
}
/* 枚举类型  */
var Direction2
;(function (Direction2) {
  Direction2['Up'] = 'up'
  Direction2['Down'] = 'down'
  Direction2['Left'] = 'left'
  Direction2['Right'] = 'right'
})(Direction2 || (Direction2 = {}))
function changeDirection2(direction) {
  console.log(direction)
}
changeDirection2(Direction2.Left)
